<template>
	<view class="deposit" :style="{'--color':vuex_config.themeColor1,'--price':vuex_config.price}">
		<view class="item" v-for="(item,index) in dataList" :key='index'>
			<view class="item-top">
				<view>订单号：{{item.order_no}}</view>
				<view class="sww-tp status_filter">{{item.pay_status | payStatus}}</view>
			</view>
			<view class="item-title">
				<view >下单时间：{{item.date_creation | format}}</view>
				<view class="price_box">
					<text class="sign">￥</text>
					<text class="price_num">{{$price(item.price)}}</text>
				</view>
			</view>
			<view class="item-title" v-if="item.remark">
				备注：{{item.remark}}
			</view>
			<!-- <view class="item-btn" v-if="item.pay_status == '1'">
				<view class="btn" @click="refund(item)">退款</view>
			</view> -->
		</view>
		<sww-load-more :params="dataListParams" ></sww-load-more>
	</view>
</template>

<script>
	import {pagingMixin} from '@/mixins/pagingMixin'
	import {
		formatDate
	} from '@/utils/moment/index.js'
	import {uniModal} from '@/utils/uniPromise'
	export default {
		mixins:[pagingMixin],
		data(){
			return{
				dataList:[]
			}
		},
		onLoad(){
			this.initPage()
		},
		filters: {
			format(time) {
				return formatDate(time,'YYYY-MM-DD HH:mm:ss')
			},
			payStatus(val){
				switch(val){
					case 0:
						return '未付款 '
					case 1:
						return '已支付'
					case 2:
						return '违约扣除'
					case 3:
						return '已退款'
					case 4:
						return '已使用'
					case 5:
						return '已冻结 '
				}
			}
		},
		onReachBottom() {
			this._load_data();
		},
		methods:{
			initPage(){
				this._init_data('GetUsersDepositInfo',{})
			},
			refund(item){
				uniModal({content:'是否退还押金'}).then(res=>{
					if(res == 'success'){
						this.$adminPost('SetOrderDirectRefund', { order_no: item.order_no, status: 3 }).then(()=>{
							uni.showModal({
								showCancel:false,
								title:'退款成功'
							})
							this.initPage()
						})
					}
				})
			}
		}
	}
</script>
<style>
	page{
		background-color: #F5F5F5;
	}
</style>
<style lang="scss" scoped>
	.deposit{
		padding: 20rpx 26rpx 0;
		.item{
			width: 100%;
			border-radius: 10rpx;
			padding: 20rpx;
			background-color: #fff;
			margin-bottom: 20rpx;
			.item-top{
				width: 100%;
				display: flex;
				align-items: center;
				justify-content: space-between;
				color: #333;
			}
			.price_box{
				color: var(--price);
				.sign{
					font-size: 24rpx;
				}
				.price_num{
					font-size: 30rpx;
				}
			}
			.item-title{
				padding-top: 12rpx;
				width: 100%;
				display: flex;
				align-items: center;
				justify-content: space-between;
				font-size: 26rpx;
				color: #999;
			}
			.item-btn{
				width: 100%;
				display: flex;
				justify-content: flex-end;
				padding-top: 20rpx;
				.btn{
					font-size: 28rpx;
					padding: 6rpx 36rpx;
					display: flex;
					align-items: center;
					justify-content: center;
					border-radius: 10rpx;
					color: #fff;
					background-color: var(--color);
				}
			}
		}
	}
</style>
